<?php

/**
 * @author christian
 * @copyright 2011
 * @abstract carga de todo el itinerario que es parte de un tour del itenario del tour
 */
 
 

$ruta=$_SERVER['DOCUMENT_ROOT']."/viventura"."/MDTour";
include_once("$ruta/conf/CConfig.php");
include_once("$ruta/elements/head.tpl");
include_once("$ruta/MDItinerary/MDEItineraryDraw.php");
include_once("$ruta/MDItinerary/MDItineraryEditDraw.php");
include_once("$ruta/MDTourGeneral/CDrawPageReg.php");
include_once("$ruta/MDTourGeneral/CTourEditDraw.php");
include_once("$ruta/MDItinerary/ServicesByDay.php");

include_once("$ruta/view/CDrawMenuTour.php");
include_once("$ruta/star.php");



$items=array("Nuevo Tour"=>"CSmallDefinePack.php","Nuevo paquete"=>"CTourEdit.php?codigo=159&default=2","Ver paquetes"=>"/viventura/MDTour/","Otra"=>"g");
CDrawMenuTour::getInstance()->setMenu($items);

CDrawMenuTour::getInstance()->DrawDivAdBegin("content_area_user_title","1");echo "<h1>Destino Sur</h1>";

CDrawMenuTour::getInstance()->rigth_side_begin();

if (!isset($_GET['default'])) {$_GET['default'] = "NULL"; }
$default = $_GET['default'];

if (!isset($_GET['pax'])) {$_GET['pax'] = "NULL"; }
$pax = $_GET['pax'];

$idPackTour=$_GET['codigo']; // El código que recibe aqui es el código del tour



/** Dibuja tabla de itinerarios ordenados por fechas*/

    $title="Itinerario del tour ". "$idPackTour";
    
if($default=="NULL"){
    $maintable="tour_has_track"; //se pasa el id de la tabla que relaciona track y tour
    $growtable="track";
    $columnas=array("idTourTrack"=>"idTourTrack","OrdTrack"=>"Orden","DescTrack"=>"Lugar","DateBegTrack"=>"Inicio","DateEndTrack"=>"Fin","OriTrack"=>"Origen","IntTrack"=>"Intermedio","DestTrack"=>"Destino");

//    MDEItineraryDraw::getInstance()->DrawTable($title,$maintable,$growtable,$columnas,$idPackTour);
    echo "</br><h2>RESUMEN DE $idPackTour</h2>";
     $major = ">1";
    ServicesByDay::getInstance()->DrawTable("Operadores",$idPackTour,$major,"actividades_has_tour_has_pasajero","DayActTra","4");
    ServicesByDay::getInstance()->DrawTable("Alimentación",$idPackTour,$major,"restaurant_has_pack_has_tour","DayActRes","2");
    ServicesByDay::getInstance()->DrawTable("Guías",$idPackTour,$major,"pack_has_tour_has_guidetc","DayActTra","3");
    ServicesByDay::getInstance()->DrawTable("Transporte",$idPackTour,$major,"transporte_has_pack_has_tour","DayActTra","1");
  
    
    if($pax>=1){
    MDEItineraryDraw::getInstance()->DrawTable("Extensiones del pasajero $pax",$maintable,$growtable,$columnas,$idPackTour);
    }
    
    
    CDrawMenuTour::getInstance()->rigth_side_end();
    
    
    echo "<p align='right'>";
    $bydays =  "MDEItinerary.php?codigo=$idPackTour&default=0";
    CDrawPageReg::getInstance()->DrawButton("Itinerario por días",$bydays);
    echo "</p>";


        
/** Seleccionar posicion de insercion del track dentro del tour*/
    
    $action="MDItineraryTemp.php";$name="formulario_registro";$method="post";$NAME="Nuevo track después de: ";
    
    MDItineraryEditDraw::getInstance()->DrawHead($action,$name,$method,$NAME);
       
    MDItineraryEditDraw::getInstance()->HiddenValue($idPackTour,"idPackTour");

    echo "<div id='dashboard_info'>";

    //$place_i = array("Al inicio"=>"0","Al final"=>"1","Despues de: "=>"2");
    //MDItineraryEditDraw::getInstance()->DrawRadioButton($place_i,"place_i");
    //Lista de extensiones
    
    MDItineraryEditDraw::getInstance()->DrawSelectItinerary($idPackTour);
    echo "<p align='right'>";
    
    MDItineraryEditDraw::getInstance()->DrawSubmmit("Continuar");
     
    CDrawPageReg::getInstance()->DrawFoot();

   
CDrawMenuTour::getInstance()->DrawDivAdEnd();
    
    }
    
    else {
        include_once("ItineraryDay.php");
    }

MDItineraryEditDraw::getInstance()->DrawFoot();



// Fin de formulario

?>
